package main

import "fmt"

type TapePlayer struct {
	Batteries string
}

func (t TapePlayer) Play(song string) {
	fmt.Println("Playing", song)
}

func (t TapePlayer) Stop() {
	fmt.Println("Stopped!")
}

type TapeRecorder struct {
	Microphones string
}

func (t TapeRecorder) Play(song string) {
	fmt.Println("Playing", song)
}

func (t TapeRecorder) Stop() {
	fmt.Println("Stopped!")
}

func (t TapeRecorder) Record() {
	fmt.Println("Recording")
}

type Player interface {
	Play(string)
	Stop()
}

func playList(device Player, song []string) {
	for _, song := range song {
		device.Play(song)
	}
	device.Stop()
}

func TryOut(player Player) {
	player.Play("Test Track")
	player.Stop()
	recorder, ok := player.(TapeRecorder)
	if ok {
		recorder.Record()
	}
}

func main() {
	mixtape := []string{"Love", "MyBaby"}
	var player Player = TapePlayer{}
	playList(player, mixtape)
	player = TapeRecorder{}
	playList(player, mixtape)
	TryOut(TapeRecorder{})
	TryOut(TapePlayer{})
}
